<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h4 align="center">修改合同</h4>
		<c:set scope="session" value="${requestScope.states }" var="s"></c:set>
		<c:if test="${s == '不可修改'}">
			<h4 align="center">该合同在履行中或已履行完毕！不可修改！</h4>
			<form:form modelAttribute="contract"  style="width: 20%; margin: auto"> 
				<form:hidden path="contractId"/>
				销售员: ${requestScope.contract.salesMan }<br>
				顾客: ${requestScope.contract.customer }<br>
				金额: ${requestScope.contract.money }<br>
				创建时间: <fmt:formatDate type="both" value="${requestScope.contract.time }"/><br>
				状态: ${requestScope.contract.states }<br>
			</form:form>
		</c:if>
		<c:if test="${s == '可修改'}">
			<form:form modelAttribute="contract" action="${pageContext.request.contextPath }/contract/update" method="post" style="width: 20%; margin: auto"> 
				<form:hidden path="contractId"/>
				<input type="hidden" name="_method" value="put">
				销售员:<form:input path="salesMan"/><br>
				顾客:<form:input path="customer"/><br>
				金额:<form:input path="money"/><br>
				创建时间:<fmt:formatDate type="both" value="${requestScope.contract.time }"/><br>
				状态:<form:input path="states"/><br>
				<input type="submit" value="提交">
			</form:form>
		</c:if>
	<form action="${pageContext.request.contextPath }/contract/list" method="get" style="width: 20%; margin: auto">
		<input type="submit" value="返回">
	</form>
</body>
</html>